﻿@using System.Drawing
@using SelfMadeMillionaire.Web.Infrastructure
@model SelfMadeMillionaire.Web.Infrastructure.ViewModels.Promotion.PromotionEditViewModel
@{
    ViewBag.Title = Model.ID != 0? "Edit Promotion": "Add New Promotion";
    
	Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}

@using (Html.BeginForm("AddOrEditPromo", "Promotion", FormMethod.Post, new { @class = "form-horizontal" }))
{
	@Html.HiddenFor(m=>m.ID)
    @Html.HiddenFor(m=>m.Status)
    @Html.ValidationSummary(null, new {@style = "color: red" })
    <div class="table-responsive">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="newsletter_seach_form">
            <tbody>
                <tr style="height: 50px" >
                <td width="12%"> @Html.LabelFor(m => m.Name, new { @class = "control-label" })</td>
                <td width="20%"> @Html.TextBoxFor(m => m.Name, new { @style = "width: 190px", @class = "form-control" })</td>
                <td width="12%"> @Html.LabelFor(m => m.Discount, new { @class = "control-label" })</td>
                <td width="16%"> @Html.TextBoxFor(m => m.Discount, new { @style = "width: 190px", @class = "form-control" })</td>		
                <td width="13%"> @Html.LabelFor(m => m.IsPercent, new { @class = "control-label" })</td>								
                <td width="8%"> @Html.RadioButtonFor(model => model.IsPercent, "true") @Html.Raw("Percent")</td>
                <td width="8%"> @Html.RadioButtonFor(model => model.IsPercent, "false") @Html.Raw("Dollar")</td>
            </tr>
            <tr style="height: 50px">
                <td width="12%"> @Html.LabelFor(m => m.EffectiveDate, new { @class = "control-label" })</td>
                <td width="20%"> @Html.TextBoxFor(m => m.EffectiveDate, "{0:" + Constants.DATE_FORMAT + "}", new { @class = "form-control", @readonly="true", @style = "width: 190px" })</td>
                <td width="12%"> @Html.LabelFor(m => m.ExpirationDate, new { @class = "control-label" })</td>
                <td width="16%"> @Html.TextBoxFor(m => m.ExpirationDate, "{0:" + Constants.DATE_FORMAT + "}", new { @class = "form-control", @readonly="true", @style = "width: 190px" })</td>									
                <td width="13%"> </td>
                <td width="8%"> </td>
                <td width="8%"> </td>
            </tr>
            <tr style="height: 50px">
                <td width="12%"> @Html.LabelFor(m => m.Product, new { @class = "control-label" })</td>	
                <td width="20%"> @Html.DropDownListFor(x => x.Product, new SelectList(Model.ProductList, "Value", "Text"), new { @style = "width: 250px", @class = "form-control" })</td>
                <td width="12%"> @Html.LabelFor(m => m.PromoCode, new { @class = "control-label" })</td>	
                <td width="16%"> @Html.TextBoxFor(m => m.PromoCode, new { @style = "width: 190px", @class = "form-control" })</td>									
                <td width="13%"> </td>
                <td width="8%"> </td>
                <td width="8%"> </td>
            </tr>
            <tr>
                <td> </td>
            </tr>
            </tbody>
        </table>
    </div>
   
    
	<div class="row">
		<div class="col-sm-12">
			<div class="pull-left">
				<button type="submit" class="btn btn-default width80">Save</button>
				<a href="@Url.Action("Index")" class="btn btn-default width80">Cancel</a>
			</div>
		</div>
	</div>
}

<script type="text/javascript">
	$(function () {

		$("#@Html.IdFor(m => m.EffectiveDate), #@Html.IdFor(m => m.EffectiveDate)").datepicker();

		$("#@Html.IdFor(m => m.EffectiveDate), #@Html.IdFor(m => m.EffectiveDate)").keypress(function (e) {
			e.preventDefault();
			$(this).datepicker();
		});

	    $("#@Html.IdFor(m => m.ExpirationDate), #@Html.IdFor(m => m.ExpirationDate)").datepicker();

	    $("#@Html.IdFor(m => m.ExpirationDate), #@Html.IdFor(m => m.ExpirationDate)").keypress(function (e) {
	        e.preventDefault();
	        $(this).datepicker();
	    });
		
	});

</script>
